home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / dev / mui / urltext.lha / Urltext / Developer / C / Examples / Urltext.c < prev   
Encoding:
C/C++ Source or Header  |  2002-01-25  |  4.3 KB  |  108 lines

  1. /* Urltext.mcc example (SAS/C) */
  2.  
  3. #include <proto/exec.h>
  4. #include <proto/dos.h>
  5. #include <proto/intuition.h>
  6. #include <proto/muimaster.h>
  7. #include <mui/urltext_mcc.h>
  8.  
  9. /***********************************************************************/
  10.  
  11. long __stack = 8192;
  12.  
  13. /***********************************************************************/
  14.  
  15. ULONG DoMethod(APTR,unsigned long MethodID,...);
  16.  
  17. /***********************************************************************/
  18.  
  19. #ifndef MAKE_ID
  20. #define MAKE_ID(a,b,c,d) ((ULONG)(a)<<24|(ULONG)(b)<<16|(ULONG)(c)<<8|(ULONG)(d))
  21. #endif
  22.  
  23. /***********************************************************************/
  24.  
  25. Object *
  26. urlTextObject(struct Library *MUIMasterBase,STRPTR url,STRPTR text,ULONG font)
  27. {
  28.     return UrltextObject,
  29.         MUIA_Font,          font,
  30.         MUIA_Urltext_Text,  text,
  31.         MUIA_Urltext_Url,   url,
  32.     End;
  33. }
  34.  
  35. /***********************************************************************/
  36.  
  37. void main(void)
  38. {
  39.     register struct Library *MUIMasterBase;
  40.  
  41.     if (MUIMasterBase = OpenLibrary("muimaster.library",19))
  42.     {
  43.         register APTR app, mwin, u0, u1, u2, u3, t0;
  44.  
  45.         if (app = ApplicationObject,
  46.             MUIA_Application_Title,         "Urltext",
  47.             MUIA_Application_Version,       "$VER: Urltext 1.2 (16.12.2001)",
  48.             MUIA_Application_Copyright,     "Copyright 2000-2001 Alfonso Ranieri",
  49.             MUIA_Application_Author,        "Alfonso Ranieri",
  50.             MUIA_Application_Description,   "Urltext example",
  51.             MUIA_Application_Base,          "URLTEXT",
  52.             SubWindow, mwin = WindowObject,
  53.                 MUIA_Window_Title,  "Urltext example",
  54.                 MUIA_Window_ID,     MAKE_ID('M','W','I','N'),
  55.                 WindowContents, VGroup,
  56.                     Child, VGroup,
  57.                         GroupFrame,
  58.                         MUIA_Background, MUII_GroupBack,
  59.                         Child, VSpace(0),
  60.                         Child, HGroup,
  61.                             Child, HSpace(0),
  62.                             Child, ColGroup(3),
  63.                                 Child, u0 = urlTextObject(MUIMasterBase,"http://web.tiscalinet.it/amiga/","Alfie's home page",MUIV_Font_Big),
  64.                                 Child, HSpace(0),
  65.                                 Child, u1 = urlTextObject(MUIMasterBase,"http://web.tiscalinet.it/amiga/rxmui","RxMUI home page",MUIV_Font_Normal),
  66.                                 Child, u2 = urlTextObject(MUIMasterBase,"http://www.egroups.co/group/rxmui","RxMUI mail list",MUIV_Font_Normal),
  67.                                 Child, HSpace(0),
  68.                                 Child, u3 = urlTextObject(MUIMasterBase,"mailto:alforan@tin.it","Alfonso Ranieri",MUIV_Font_Normal),
  69.                             End,
  70.                             Child, HSpace(0),
  71.                         End,
  72.                         Child, VSpace(0),
  73.                     End,
  74.                     Child, t0 = TextObject,
  75.                         MUIA_Frame,         MUIV_Frame_Text,
  76.                         MUIA_Background,    MUII_TextBack,
  77.                         MUIA_Text_PreParse, (ULONG)"\33c",
  78.                     End,
  79.                 End,
  80.             End,
  81.         End)
  82.         {
  83.             ULONG sigs;
  84.  
  85.             DoMethod(mwin,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,app,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit);
  86.  
  87.             DoMethod(u0,MUIM_Notify,MUIA_Urltext_Url,MUIV_EveryTime,t0,3,MUIM_Set,MUIA_Text_Contents,MUIV_TriggerValue);
  88.             DoMethod(u1,MUIM_Notify,MUIA_Urltext_Url,MUIV_EveryTime,t0,3,MUIM_Set,MUIA_Text_Contents,MUIV_TriggerValue);
  89.             DoMethod(u2,MUIM_Notify,MUIA_Urltext_Url,MUIV_EveryTime,t0,3,MUIM_Set,MUIA_Text_Contents,MUIV_TriggerValue);
  90.             DoMethod(u3,MUIM_Notify,MUIA_Urltext_Url,MUIV_EveryTime,t0,3,MUIM_Set,MUIA_Text_Contents,MUIV_TriggerValue);
  91.  
  92.             set(mwin,MUIA_Window_Open,TRUE);
  93.  
  94.             for (sigs = 0; DoMethod(app,MUIM_Application_NewInput,&sigs)!=MUIV_Application_ReturnID_Quit; )
  95.                 if (sigs && ((sigs = Wait(sigs|SIGBREAKF_CTRL_C)) & SIGBREAKF_CTRL_C))
  96.                      break;
  97.  
  98.             MUI_DisposeObject(app);
  99.         }
  100.         else Printf("Can't create Application\n");
  101.  
  102.         CloseLibrary(MUIMasterBase);
  103.     }
  104.     else Printf("Can't open muimaster.library version 19 or higher\n");
  105. }
  106.  
  107. /***********************************************************************/
  108.